home *** CD-ROM | disk | FTP | other *** search
/ AGA Toolkit '97 / The AGA Toolkit '97.iso / text / misc / port / oldstuff / portsource.lha / Port125.S < prev    next >
Encoding:
Text File  |  1993-03-12  |  23.0 KB  |  1,699 lines

  1. testmode    =    1
  2.  
  3.     include    "src:shadowlord.i"
  4.  
  5. ; V1.01
  6. ; Added bigger understanding of PC box characters.
  7. ; Now also understands one-wide box chars, and thick corner changed to #,
  8. ; single corner to +.
  9.  
  10. ; V1.02
  11. ; Added bad mode error, and error on no space between mode and the rest.
  12.  
  13. ; V1.10
  14. ; Cut endspace.
  15. ; Text output.
  16.  
  17. ; V1.13
  18. ; Percentage & size change
  19. ; extra lf
  20. ; extra cr removal in topc mode
  21.  
  22. ; V1.16
  23. ; Faster translate routines  25% speedup in frompc
  24. ; 6 more in frompc
  25. ; New helptext.
  26.  
  27. ; V1.18  11-feb
  28. ; Upper and lower case modes.
  29.  
  30. ; V1.22  19-feb
  31. ; tabs to spaces
  32. ; 3 new pc box chars
  33. ; bug fixed that confused port if the end of the commandline had spaces.
  34. ; spaces to tabs
  35.  
  36. ; V1.24  21-feb
  37. ; size reduced by 48
  38. ; bug fixed where tabconversion wasn't turned on in spacestotabs
  39. ; causing some strange behavior.
  40. ; reduced code size by making routines use same parts of code.
  41. ; Logic check for options
  42. ; 20% when quiet
  43.  
  44. ; V1.25  11-mar
  45. ; buffer overflow bug fixed
  46. ; new table conversion system
  47. ; buffered input
  48. ; handles one filename differently
  49. ; ctrl+c detection
  50. ; doesn't screw up pp files
  51. ; 6856 -> 6636
  52. ; 9 new pc chars
  53. ; end lf removal
  54. ; no longer translates one space
  55.  
  56. * 12-Mar-93
  57. * 24 days of hard coding
  58.  
  59. ; during the program
  60. ; a0=source
  61. ; a1=dest
  62. ; a2=spacebuf
  63. ; a3=translation table
  64.  
  65. ; d0=current char
  66. ; d1=load counter
  67. ; d2=savebyte counter
  68. ; d3=translation char
  69.  
  70.  
  71.     if    testmode=1
  72.     lea    test_comline,a0
  73.     move.l    #test_len,d0
  74.     endc
  75.  
  76. progstart:
  77.     clr.b    -1(a0,d0.l)
  78.     move.l    a0,commandstart
  79.     move.w    d0,commandlen
  80.     add.l    d0,a0
  81.     subq.l    #1,a0
  82.     move.l    a0,commandend
  83.  
  84.     lea    dosname,a1
  85.     moveq    #0,d0
  86.     move.l    execbase,a6
  87.     jsr    openlibrary(a6)
  88.     move.l    d0,dosbase
  89.  
  90.     move.l    dosbase,a6
  91.     jsr    output(a6)
  92.     move.l    d0,outstruct
  93.  
  94.     if    testmode=1
  95.     bne    err_testmode
  96.     endc
  97.  
  98.     move.l    #text_cursoroff,d2
  99.     moveq    #5,d3
  100.     bsr    printtext
  101.  
  102.     move.l    commandstart,a0
  103.     tst.b    (a0)            ; if blank commandline, instructions
  104.     beq    helptext
  105.     cmp.b    #"?",(a0)
  106.     beq    helptext
  107.  
  108. parsestart:
  109.     cmp.b    #"-",(a0)
  110.     beq    checkoption
  111.  
  112. parse:
  113.     cmp.b    #" ",1(a0)        ; at least one space after option
  114.     bne    err_nocomlinespace
  115.     cmp.b    #"p",(a0)
  116.     beq    frompcmode
  117.     cmp.b    #"P",(a0)
  118.     beq    topcmode
  119.     cmp.b    #"s",(a0)
  120.     beq    fromsf7mode
  121.     cmp.b    #"S",(a0)
  122.     beq    tosf7mode
  123.     cmp.b    #"u",(a0)
  124.     beq    toupcasemode
  125.     cmp.b    #"l",(a0)
  126.     beq    tolowcasemode
  127.     cmp.b    #"n",(a0)
  128.     beq    modetonull
  129.     bra    err_badmode
  130.  
  131. checkoption:
  132.     cmp.b    #"n",1(a0)
  133.     beq    opt_nocutspace
  134.     cmp.b    #"?",1(a0)
  135.     beq    credits
  136.     cmp.b    #"t",1(a0)
  137.     beq    opt_tabconv
  138.     cmp.b    #"s",1(a0)
  139.     beq    opt_spaceconv
  140.     cmp.b    #"q",1(a0)
  141.     beq    opt_quietmode
  142.     cmp.b    #"b",1(a0)
  143.     beq    opt_nobuffermode
  144.     bra    err_badcomline
  145.  
  146. opt_nocutspace:
  147.     move.b    #1,mode_nocutspace
  148.     addq.l    #2,a0
  149.     bra    opt_next
  150.  
  151. opt_tabconv:
  152.     tst.b    tabsize
  153.     bne    err_badlogic
  154.     move.b    2(a0),d0
  155.     cmp.b    #" ",d0
  156.     beq    opt_tabconv1
  157.     sub.b    #"0",d0
  158.     cmp.b    #9,d0
  159.     bhi    err_badcomline
  160.     cmp.b    #1,d0
  161.     bcs    err_badcomline
  162.     bra    opt_bothconv
  163.  
  164. opt_tabconv1:
  165.     move.b    #8,d0
  166.     subq.l    #1,a0
  167.     bra    opt_bothconv
  168.  
  169. opt_spaceconv:
  170.     tst.b    tabsize
  171.     bne    err_badlogic
  172.     move.b    2(a0),d0
  173.     cmp.b    #" ",d0
  174.     beq    opt_spaceconv1
  175.     sub.b    #"0",d0
  176.     cmp.b    #9,d0
  177.     bhi    err_badcomline
  178.     cmp.b    #1,d0
  179.     bcs    err_badcomline
  180.     move.b    d0,spacesize
  181.     bra    opt_bothconv
  182.  
  183. opt_spaceconv1:
  184.     move.b    #8,d0
  185.     move.b    d0,spacesize
  186.     subq.l    #1,a0
  187.  
  188. opt_bothconv:
  189.     move.b    d0,tabsize
  190.     addq.l    #3,a0
  191.     bra    opt_next
  192.  
  193. opt_quietmode:
  194.     move.b    #1,mode_quiet
  195.     addq.l    #2,a0
  196.     bra    opt_next
  197.  
  198. opt_nobuffermode:
  199.     move.b    #1,mode_nobuffer
  200.     addq.l    #2,a0
  201.  
  202. opt_next:
  203.     cmp.b    #" ",(a0)
  204.     bne    err_badcomline
  205.     bsr    skipspace
  206.     cmp.l    #0,a0
  207.     beq    err_badcomline
  208.     bra    parsestart
  209.  
  210. frompcmode:
  211.     move.b    #1,mode
  212.     lea    table_frompc,a1
  213.     move.l    a1,table
  214.     bra    nameparse
  215.  
  216. fromsf7mode:
  217.     move.b    #2,mode
  218. ;    lea    table_fromsf7,table
  219.     bra    nameparse
  220.  
  221. tosf7mode:
  222.     move.b    #-2,mode
  223. ;    lea    table_tosf7,table
  224.     bra    nameparse
  225.  
  226. topcmode:
  227.     move.b    #-1,mode
  228. ;    lea    table_topc,table
  229.     bra    nameparse
  230.  
  231. toupcasemode:
  232.     move.b    #3,mode
  233.     bra    nameparse
  234.  
  235. tolowcasemode:
  236.     move.b    #4,mode
  237.     bra    nameparse
  238.  
  239. modetonull:
  240.     move.b    #5,mode
  241.  
  242. nameparse:
  243.     addq.l    #1,a0
  244.     bsr    skipspace
  245.     cmp.l    #0,a0
  246.     beq    err_badcomline
  247.     move.l    a0,sourcenamestart
  248.     bsr    findend
  249.     cmp.l    #0,a0
  250.     beq    err_badcomline
  251.     move.l    a0,sourcenameend
  252.     addq.l    #1,a0
  253.     sub.l    sourcenamestart,a0
  254.     move.l    a0,sourcenamelen
  255.  
  256.     move.l    sourcenamestart,a0
  257.     move.l    #sourcename,a1
  258.     move.l    sourcenamelen,d0
  259.     subq.l    #1,d0
  260.     bsr    removequotes
  261.  
  262. copysourcename:
  263.     move.b    (a0)+,(a1)+
  264.     dbf    d0,copysourcename
  265.     clr.b    (a1)
  266.  
  267.     move.l    sourcenameend,a0
  268.     addq.l    #1,a0
  269.     cmp.l    commandend,a0
  270.     beq    nodest
  271.  
  272.     bsr    skipspace
  273.     cmp.l    #0,a0
  274.     beq    nodest
  275.     move.l    a0,destnamestart
  276.     bsr    findend
  277.     cmp.l    #0,a0
  278.     beq    err_badcomline
  279.     move.l    a0,destnameend
  280.     addq.l    #1,a0
  281.     sub.l    destnamestart,a0
  282.     move.l    a0,destnamelen
  283.     move.l    a0,d0
  284.  
  285.     move.l    destnamestart,a0
  286.     move.l    #destname,a1
  287.     subq.l    #1,d0
  288.     bsr    removequotes
  289.  
  290. copydestname:
  291.     move.b    (a0)+,(a1)+
  292.     dbf    d0,copydestname
  293.     bra    openfiles
  294.  
  295. nodest:
  296.     move.l    #destname,a1
  297.     move.l    sourcenamestart,a0
  298.     move.l    sourcenamelen,d0
  299.     subq.l    #1,d0
  300.     bsr    removequotes
  301.  
  302. copydestname1:
  303.     move.b    (a0)+,(a1)+
  304.     dbf    d0,copydestname1
  305.  
  306.     tst.b    mode_nobuffer
  307.     beq    openfiles
  308.  
  309.     cmp.b    #-1,mode
  310.     beq    pcsuffix
  311.     cmp.b    #-2,mode
  312.     beq    sf7suffix
  313.  
  314. amigasuffix:
  315.     lea    text_amigasuf,a0
  316.     moveq    #4-1,d0
  317.     bra    addsuffix
  318.  
  319. pcsuffix:
  320.     lea    text_pcsuf,a0
  321.     moveq    #3-1,d0
  322.     bra    addsuffix
  323.  
  324. sf7suffix:
  325.     lea    text_sf7suf,a0
  326.     moveq    #4-1,d0
  327.  
  328. addsuffix:
  329.     move.b    (a0)+,(a1)+
  330.     dbf    d0,addsuffix
  331.  
  332. openfiles:
  333.     clr.b    (a1)            ; end of filename
  334.  
  335.     tst.b    mode_nobuffer
  336.     beq    openfiles1
  337.  
  338.     move.l    #sourcename,d1
  339.     move.l    #mode_oldfile,d2
  340.     move.l    dosbase,a6
  341.     jsr    open(a6)
  342.     move.l    d0,sourcehandle
  343.     beq    err_nosource
  344.  
  345.     move.l    sourcehandle,d1
  346.     move.l    #sourcebuf,d2
  347.     add.l    readbytes,d2
  348.     move.l    #4,d3
  349.     move.l    dosbase,a6
  350.     jsr    read(a6)
  351.     cmp.l    #4,d0
  352.     bne    openfiles2
  353.  
  354.     move.l    sourcebuf,d0
  355.     cmp.l    #"PP20",d0
  356.     beq    err_powerpacked
  357.  
  358.     move.l    sourcehandle,d1        ; seek back to the beginning of file
  359.     moveq    #0,d2
  360.     moveq    #offset_beginning,d3
  361.     move.l    dosbase,a6
  362.     jsr    seek(a6)
  363.  
  364.     move.l    #destname,d1
  365.     move.l    #mode_newfile,d2
  366.     move.l    dosbase,a6
  367.     jsr    open(a6)
  368.     move.l    d0,desthandle
  369.     beq    err_nodest
  370.  
  371.     move.l    #sourcebuf,sourcepointer
  372.     bra    readblock
  373.  
  374. openfiles1:
  375.     move.l    #sourcename,d1
  376.     move.l    #access_read,d2
  377.     move.l    dosbase,a6
  378.     jsr    lock(a6)
  379.     move.l    d0,sourcelock        ; error detection, 0=fail
  380.  
  381.     move.l    sourcelock,d1
  382.     move.l    #fib,d2
  383.     move.l    dosbase,a6
  384.     jsr    examine(a6)        ; error detection, 0=fail
  385.  
  386.     move.l    #fib,a0
  387.     move.l    fib_size(a0),sourcelen
  388.  
  389.     lea    sourcelenascii,a0
  390.     move.l    sourcelen,d0
  391.     bsr    num2ascii
  392.     move.l    a0,sourcelenasciiaddr
  393.     move.l    d0,sourcelenasciilen
  394.  
  395.     move.l    sourcelock,d1
  396.     move.l    dosbase,a6
  397.     jsr    unlock(a6)
  398.  
  399.     move.l    #sourcename,d1
  400.     move.l    #1005,d2
  401.     move.l    dosbase,a6
  402.     jsr    open(a6)
  403.     move.l    d0,sourcehandle
  404.     beq    err_nosource
  405.  
  406.     move.l    sourcehandle,d1
  407.     move.l    #sourcebuf,d2
  408.     add.l    readbytes,d2
  409.     move.l    #4,d3
  410.     move.l    dosbase,a6
  411.     jsr    read(a6)
  412.     cmp.l    #4,d0
  413.     bne    openfiles2
  414.  
  415.     move.l    sourcebuf,d0
  416.     cmp.l    #"PP20",d0
  417.     beq    err_powerpacked
  418.  
  419.     move.l    sourcehandle,d1        ; seek back to the beginning of file
  420.     moveq    #0,d2
  421.     moveq    #offset_beginning,d3
  422.     move.l    dosbase,a6
  423.     jsr    seek(a6)
  424.  
  425. openfiles2:
  426.     move.l    sourcelen,d0
  427.     moveq    #1,d1            ; public mem
  428.     move.l    execbase,a6
  429.     jsr    allocmem(a6)
  430.     move.l    d0,sourcepointer
  431.     beq    err_nomem
  432.  
  433. readfile:
  434.     move.l    sourcehandle,d1
  435.     move.l    sourcepointer,d2
  436.     add.l    readbytes,d2
  437.     move.l    #10240,d3
  438.     move.l    dosbase,a6
  439.     jsr    read(a6)
  440.     cmp.l    #-1,d0
  441.     beq    err_readfail
  442.     add.l    d0,readbytes
  443.     movem.l    d0,-(a7)
  444.     tst.b    mode_quiet
  445.     bne    testread
  446.  
  447.     move.l    #text_read,d2
  448.     moveq    #14,d3
  449.     bsr    printtext
  450.  
  451.     lea    readascii,a0
  452.     move.l    readbytes,d0
  453.     bsr    num2ascii
  454.  
  455.     move.l    a0,readasciiaddr
  456.     move.l    d0,readasciilen
  457.     move.l    a0,d2
  458.     move.l    d0,d3
  459.     bsr    printtext
  460.  
  461.     move.l    #text_slash,d2
  462.     moveq    #1,d3
  463.     bsr    printtext
  464.  
  465.     move.l    sourcelenasciiaddr,d2
  466.     move.l    sourcelenasciilen,d3
  467.     bsr    printtext
  468.  
  469.     move.l    #text_cr,d2
  470.     moveq    #1,d3
  471.     bsr    printtext
  472.  
  473. testread:
  474.     movem.l    (a7)+,d0
  475.     tst.l    d0            ; = number of bytes read
  476.     beq    readfinished
  477.     move.l    readbytes,leftbytes
  478.  
  479.     sub.l    d0,d0
  480.     sub.l    d1,d1
  481.     move.l    execbase,a6
  482.     jsr    setsignal(a6)
  483.  
  484.     btst    #12,d0            ; check if ^C was pressed
  485.     bne    breakpressed
  486.  
  487.     bra    readfile
  488.  
  489. readfinished:
  490.     move.l    sourcehandle,d1
  491.     move.l    dosbase,a6
  492.     jsr    close(a6)
  493.  
  494.     move.l    #destname,d1
  495.     move.l    #1006,d2
  496.     move.l    dosbase,a6
  497.     jsr    open(a6)
  498.     move.l    d0,desthandle
  499.     beq    err_nodest
  500.  
  501.     bra    moredata
  502.  
  503. readblock:
  504.     tst.b    mode_nobuffer
  505.     beq    moredata
  506.  
  507.     move.l    sourcehandle,d1
  508.     move.l    sourcepointer,d2
  509.     move.l    #1024,d3
  510.     move.l    dosbase,a6
  511.     jsr    read(a6)
  512.     cmp.l    #-1,d0
  513.     beq    err_readfail
  514.     add.l    d0,readbytes
  515.     move.l    d0,d1
  516.     beq    closefiles        ; readbytes=0 - quit
  517.     subq.l    #1,d1
  518.     sub.l    d2,d2
  519.     lea    sourcebuf,a0
  520.     lea    destbuf,a1
  521.     bra    morecharacters
  522.  
  523. moredata:
  524.     tst.l    leftbytes
  525.     beq    closefiles
  526.     sub.l    d2,d2
  527.     cmp.l    #1024,leftbytes
  528.     bls    moredata1
  529.     sub.l    #1024,leftbytes
  530.     move.l    sourcepointer,a0
  531.     add.l    inputbytes,a0
  532.     add.l    #1024,inputbytes
  533.     move.l    #1024-1,d1
  534.     lea    destbuf,a1
  535.     bra    morecharacters
  536.  
  537. moredata1:
  538.     move.l    leftbytes,d0
  539.     clr.l    leftbytes
  540.     move.l    sourcepointer,a0
  541.     add.l    inputbytes,a0
  542.     add.l    d0,inputbytes
  543.     subq.l    #1,d0
  544.     move.l    d0,d1
  545.     lea    destbuf,a1
  546.  
  547. morecharacters:
  548.     move.b    (a0)+,d0
  549.     bra    cutspace
  550.  
  551. checknormal:
  552.     cmp.b    #-2,mode
  553.     beq    tosf7
  554.     cmp.b    #-1,mode
  555.     beq    topc
  556.     cmp.b    #2,mode
  557.     beq    fromsf7
  558.     cmp.b    #3,mode
  559.     beq    toupcase
  560.     cmp.b    #4,mode
  561.     beq    tolowcase
  562.     cmp.b    #5,mode
  563.     beq    nullmode
  564.  
  565. frompc:
  566.     cmp.b    #" ",d0
  567.     bcs    translate
  568.     cmp.b    #"~",d0
  569.     bhi    translate
  570.     bra    nextchar
  571.  
  572. translate:
  573.     move.l    table,a3
  574.     tst.b    d0
  575.     beq    nochar
  576.  
  577. translate1:
  578.     move.w    (a3)+,d3
  579.     beq    nextchar        ; 0=end of table
  580.     cmp.b    d3,d0
  581.     beq    translate2
  582.     bra    translate1
  583.  
  584. translate2:
  585.     lsr.w    #8,d3
  586.     move.b    d3,d0            ; if 0=no char
  587.     beq    nochar
  588.  
  589. nextchar:
  590.     move.b    d0,(a1)+
  591.     addq.l    #1,d2
  592.     addq.w    #1,col
  593.  
  594. nochar:
  595.     dbf    d1,morecharacters
  596.  
  597.     move.l    desthandle,d1        ; write the converted data ~1024 bytes
  598.     move.l    d2,d3
  599.     add.l    d2,writtenbytes
  600.     move.l    #destbuf,d2
  601.     move.l    dosbase,a6
  602.     jsr    write(a6)
  603.     cmp.l    #-1,d0
  604.     beq    err_writefail
  605.  
  606.     sub.l    d0,d0
  607.     sub.l    d1,d1
  608.     move.l    execbase,a6
  609.     jsr    setsignal(a6)
  610.  
  611.     btst    #12,d0            ; check if ^C was pressed
  612.     bne    endprogram5
  613.  
  614.     tst.b    mode_quiet
  615.     bne    readblock
  616.  
  617.     tst.b    mode_nobuffer
  618.     beq    alternateoutput
  619.  
  620.     move.l    #text_input,d2
  621.     moveq    #15,d3
  622.     bsr    printtext
  623.  
  624.     lea    numberbuf,a0
  625.     move.l    readbytes,d0
  626.     bsr    num2ascii
  627.  
  628.     move.l    a0,d2
  629.     move.l    d0,d3
  630.     bsr    printtext
  631.  
  632.     move.l    #text_output,d2
  633.     moveq    #18,d3
  634.     bsr    printtext
  635.  
  636.     lea    numberbuf,a0
  637.     move.l    writtenbytes,d0
  638.     bsr    num2ascii
  639.  
  640.     move.l    a0,d2
  641.     move.l    d0,d3
  642.     bsr    printtext
  643.  
  644.     move.l    #text_cr,d2
  645.     moveq    #1,d3
  646.     bsr    printtext
  647.  
  648.     bra    readblock
  649.  
  650. alternateoutput:
  651.     move.l    #text_converted,d2
  652.     moveq    #19,d3
  653.     bsr    printtext
  654.  
  655.     lea    numberbuf,a0
  656.     move.l    inputbytes,d0
  657.     bsr    num2ascii
  658.  
  659.     move.l    a0,d2
  660.     move.l    d0,d3
  661.     bsr    printtext
  662.  
  663.     move.l    #text_slash,d2
  664.     moveq    #1,d3
  665.     bsr    printtext
  666.  
  667.     move.l    readasciiaddr,d2
  668.     move.l    readasciilen,d3
  669.     bsr    printtext
  670.  
  671.     move.l    #text_cr,d2
  672.     moveq    #1,d3
  673.     bsr    printtext
  674.  
  675.     bra    readblock
  676.  
  677. cutspace:
  678.     move.l    spacepointer,a2
  679.     cmp.b    #" ",d0
  680.     beq    addspace
  681.     cmp.b    #9,d0            ; tab
  682.     beq    addtab
  683.     bsr    addeol
  684.  
  685.     tst.b    mode_nocutspace
  686.     bne    cutspace2
  687.  
  688.     cmp.b    #10,d0            ; lf
  689.     beq    cutspaces
  690.     cmp.b    #13,d0            ; cr
  691.     beq    cutspaces
  692.  
  693. cutspace1:
  694.     tst.b    prespace
  695.     bne    insertprespace
  696.     tst.l    tabs
  697.     bne    linkspaces
  698.  
  699. cutspace3:
  700.     tst.l    spacenumber
  701.     bne    linkspaces2
  702.  
  703. cutspace4:
  704.     cmp.b    #10,d0
  705.     beq    nochar
  706.     tst.b    mode_nocutspace
  707.     beq    testforspace
  708.  
  709. linkeols:
  710.     move.l    eols,d3
  711.     bne    linkeols1
  712.     cmp.b    #" ",d0
  713.     beq    nochar
  714.     cmp.b    #9,d0
  715.     beq    nochar
  716.     bra    checknormal
  717.  
  718. linkeols1:
  719.     add.l    d3,d2
  720.     subq.l    #1,d3
  721.  
  722. linkeols2:
  723.     move.b    #10,(a1)+
  724.     dbf    d3,linkeols2
  725.     clr.l    eols
  726.     cmp.b    #" ",d0
  727.     beq    nochar
  728.     cmp.b    #9,d0
  729.     beq    nochar
  730.     bra    checknormal
  731.  
  732. testforspace:
  733.     cmp.b    #" ",d0
  734.     beq    nochar
  735.     cmp.b    #9,d0
  736.     beq    nochar
  737.     bra    linkeols
  738.  
  739. cutspace2:
  740.     cmp.b    #10,d0
  741.     beq    clearcol
  742.     cmp.b    #13,d0
  743.     beq    clearcol
  744.     bra    cutspace1
  745.  
  746. clearcol:
  747.     clr.w    col
  748.     bra    cutspace1
  749.  
  750. addspace:
  751.     addq.l    #1,spacenumber
  752.     move.b    d0,(a2)+
  753.     move.l    a2,spacepointer
  754.     addq.w    #1,col
  755.     bra    checkconvspace
  756.  
  757. addtab:
  758.     move.b    tabsize,d4        ; if tabsize is zero, just add it in
  759.     bne    tabconv            ; spacebuffer
  760.     bra    addspace
  761.  
  762. tabconv:
  763.     ext.w    d4
  764.     ext.l    d4
  765.     move.w    col,d3
  766.     ext.l    d3
  767.     divu    d4,d3
  768.     swap    d3
  769.     sub.w    d3,d4
  770.     add.l    d4,spacenumber
  771.     add.w    d4,col
  772.     subq.w    #1,d4
  773.     move.b    #" ",d0
  774.  
  775. tabconv1:
  776.     move.b    d0,(a2)+
  777.     dbf    d4,tabconv1
  778.     move.l    a2,spacepointer
  779.  
  780. checkconvspace:
  781.     tst.b    spacesize        ; spacesize=0 means no space2tab
  782.     beq    cutspace4
  783.     cmp.l    #1,spacenumber        ; if spacenumber<1, skip
  784.     bcs    cutspace4
  785.     move.w    col,d5
  786.     ext.l    d5
  787.     move.l    spacenumber,d3
  788.     move.b    spacesize,d4
  789.     ext.w    d4
  790.     ext.l    d4
  791.  
  792.     divu    d4,d5            ; if column is divisible by spacesize,
  793.     swap    d5            ; go to "foundconvspace"
  794.     tst.w    d5
  795.     beq    foundconvspace
  796.     bra    cutspace4        ; otherwise just continue
  797.  
  798. foundconvspace:
  799.     cmp.l    #1,spacenumber        ; if only one space is won, don't
  800.     beq    foundconvspace2
  801.     move.l    #spacebuf,spacepointer
  802.     addq.l    #1,tabs
  803.     sub.l    d4,spacenumber
  804.     bmi    foundconvspace1
  805.     bra    cutspace4
  806.  
  807. foundconvspace1:
  808.     clr.l    spacenumber
  809.     bra    cutspace4
  810.  
  811. foundconvspace2:
  812.     move.b    #1,prespace
  813.     move.l    #spacebuf,spacepointer
  814.     clr.l    spacenumber
  815.     bra    cutspace4
  816.  
  817. cutspaces:
  818.     clr.l    spacenumber
  819.     clr.l    tabs
  820.     move.l    #spacebuf,spacepointer
  821.     clr.w    col
  822.     bra    nochar
  823.  
  824. addeol:
  825.     cmp.b    #10,d0
  826.     beq    addeol1
  827.     rts
  828.  
  829. addeol1:
  830.     addq.l    #1,eols
  831.     rts
  832.  
  833. linkspaces:
  834.     tst.b    mode_nocutspace
  835.     bne    linkspaces4
  836.     bsr    inserteols
  837.  
  838. linkspaces4:
  839.     move.l    tabs,d3
  840.     clr.l    tabs
  841.     add.l    d3,d2            ; tabs -> bytes to be written
  842.     subq.l    #1,d3
  843.  
  844. linkspaces1:
  845.     move.b    #9,(a1)+
  846.     dbf    d3,linkspaces1
  847.     bra    cutspace3
  848.  
  849. linkspaces2:
  850.     tst.b    mode_nocutspace
  851.     bne    linkspaces5
  852.     bsr    inserteols
  853.  
  854. linkspaces5:
  855.     move.l    spacenumber,d3
  856.     add.l    d3,d2            ; spaces -> bytes to be written
  857.     subq.l    #1,d3
  858.     lea    spacebuf,a2
  859.     move.l    a2,spacepointer
  860.  
  861. linkspaces3:
  862.     move.b    (a2)+,(a1)+
  863.     dbf    d3,linkspaces3
  864.     clr.l    spacenumber
  865.     bra    cutspace4
  866.  
  867. insertprespace:
  868.     clr.b    prespace
  869.     move.b    #" ",(a1)+
  870.     addq.l    #1,d2
  871.     bra    cutspace1
  872.  
  873. inserteols:
  874.     move.l    eols,d3
  875.     bne    inserteols1
  876.     rts
  877.  
  878. inserteols1:
  879.     add.l    d3,d2
  880.     subq.l    #1,d3
  881.  
  882. inserteols2:
  883.     move.b    #10,(a1)+
  884.     dbf    d3,inserteols2
  885.     clr.l    eols
  886.     rts
  887.  
  888. topc:
  889.     cmp.b    #"ä",d0
  890.     beq    pc_lowae
  891.     cmp.b    #"ö",d0
  892.     beq    pc_lowoe
  893.     cmp.b    #"Ä",d0
  894.     beq    pc_upae
  895.     cmp.b    #"Ö",d0
  896.     beq    pc_upoe
  897.     cmp.b    #13,d0
  898.     beq    nochar
  899.     cmp.b    #10,d0
  900.     beq    addcr
  901.     cmp.b    #0,d0
  902.     beq    nochar
  903.     cmp.b    #$1a,d0            ; ctrl+z
  904.     beq    nochar
  905.     bra    nextchar
  906.  
  907. fromsf7:
  908.     cmp.b    #"{",d0
  909.     beq    ami_lowae
  910.     cmp.b    #"|",d0
  911.     beq    ami_lowoe
  912.     cmp.b    #"[",d0
  913.     beq    ami_upae
  914.     cmp.b    #"\",d0
  915.     beq    ami_upoe
  916.     cmp.b    #13,d0
  917.     beq    nochar
  918.     cmp.b    #0,d0
  919.     beq    nochar
  920.     cmp.b    #$1a,d0            ; ctrl+z
  921.     beq    nochar
  922.     bra    nextchar
  923.  
  924. tosf7:
  925.     cmp.b    #"ä",d0
  926.     beq    sf7_lowae
  927.     cmp.b    #"ö",d0
  928.     beq    sf7_lowoe
  929.     cmp.b    #"Ä",d0
  930.     beq    sf7_upae
  931.     cmp.b    #"Ö",d0
  932.     beq    sf7_upoe
  933.     cmp.b    #10,d0
  934.     beq    addcr
  935.     cmp.b    #0,d0
  936.     beq    nochar
  937.     cmp.b    #$1a,d0            ; ctrl+z
  938.     beq    nochar
  939.     bra    nextchar
  940.  
  941. toupcase:
  942.     cmp.b    #"ä",d0
  943.     beq    ami_upae
  944.     cmp.b    #"ö",d0
  945.     beq    ami_upoe
  946.     cmp.b    #"a",d0
  947.     bcs    nextchar
  948.     cmp.b    #"z",d0
  949.     bhi    nextchar
  950.  
  951.     and.b    #%11011111,d0
  952.     bra    nextchar
  953.  
  954. tolowcase:
  955.     cmp.b    #"Ä",d0
  956.     beq    ami_lowae
  957.     cmp.b    #"Ö",d0
  958.     beq    ami_lowoe
  959.     cmp.b    #"A",d0
  960.     bcs    nextchar
  961.     cmp.b    #"Z",d0
  962.     bhi    nextchar
  963.  
  964.     or.b    #%100000,d0
  965.     bra    nextchar
  966.  
  967. nullmode:
  968.     cmp.b    #13,d0
  969.     beq    nochar
  970.     cmp.b    #0,d0
  971.     beq    nochar
  972.     cmp.b    #$1a,d0            ; ctrl+z
  973.     beq    nochar
  974.     bra    nextchar
  975.  
  976. ami_182:
  977.     move.b    #182,d0
  978.     bra    nextchar
  979.  
  980. ami_231:
  981.     move.b    #231,d0
  982.     bra    nextchar
  983.  
  984. ami_singleline:
  985.     move.b    #"-",d0
  986.     bra    nextchar
  987.  
  988. ami_box:
  989.     move.b    #$7f,d0
  990.     bra    nextchar
  991.  
  992. ami_upline:
  993.     move.b    #"|",d0
  994.     bra    nextchar
  995.  
  996. ami_doubleline:
  997.     move.b    #"=",d0
  998.     bra    nextchar
  999.  
  1000. ami_smallcorner:
  1001.     move.b    #"+",d0
  1002.     bra    nextchar
  1003.  
  1004. ami_bigcorner:
  1005.     move.b    #"#",d0
  1006.     bra    nextchar
  1007.  
  1008. ami_lowae:
  1009.     move.b    #"ä",d0
  1010.     bra    nextchar
  1011.  
  1012. ami_lowoe:
  1013.     move.b    #"ö",d0
  1014.     bra    nextchar
  1015.  
  1016. ami_upae:
  1017.     move.b    #"Ä",d0
  1018.     bra    nextchar
  1019.  
  1020. ami_upoe:
  1021.     move.b    #"Ö",d0
  1022.     bra    nextchar
  1023.  
  1024. pc_lowae:
  1025.     move.b    #$84,d0
  1026.     bra    nextchar
  1027.  
  1028. pc_lowoe:
  1029.     move.b    #$94,d0
  1030.     bra    nextchar
  1031.  
  1032. pc_upae:
  1033.     move.b    #$8e,d0
  1034.     bra    nextchar
  1035.  
  1036. pc_upoe:
  1037.     move.b    #$99,d0
  1038.     bra    nextchar
  1039.  
  1040. sf7_lowae:
  1041.     move.b    #"{",d0
  1042.     bra    nextchar
  1043.  
  1044. sf7_lowoe:
  1045.     move.b    #"|",d0
  1046.     bra    nextchar
  1047.  
  1048. sf7_upae:
  1049.     move.b    #"[",d0
  1050.     bra    nextchar
  1051.  
  1052. sf7_upoe:
  1053.     move.b    #"\",d0
  1054.     bra    nextchar
  1055.  
  1056. addcr:
  1057.     move.b    #13,(a1)+
  1058.     addq.l    #1,d2
  1059.     bra    nextchar
  1060.  
  1061. closefiles:
  1062.     tst.b    mode_nobuffer
  1063.     beq    freebuffer
  1064.     bsr    closesource
  1065.     bra    closefiles3
  1066.  
  1067. freebuffer:
  1068.     bsr    freememory
  1069.  
  1070. closefiles3:
  1071.     bsr    closedest
  1072.  
  1073.     move.l    #text_final,d2
  1074.     moveq    #26,d3
  1075.     bsr    printtext
  1076.  
  1077.     move.l    readbytes,d1
  1078.     move.l    writtenbytes,d0
  1079.  
  1080.     sub.l    d1,d0
  1081.     bmi    closefiles1        ; negative
  1082.  
  1083.     move.l    d0,d7
  1084.     beq    closefiles2        ; if zero, no sign
  1085.  
  1086.     move.l    #text_possign,d2
  1087.     moveq    #1,d3
  1088.     bsr    printtext
  1089.     bra    closefiles2
  1090.  
  1091. closefiles1:
  1092.     neg.l    d0
  1093.     move.l    d0,d7
  1094.  
  1095.     move.l    #text_negsign,d2
  1096.     moveq    #1,d3
  1097.     bsr    printtext
  1098.  
  1099. closefiles2:
  1100.     move.l    d7,d0
  1101.     lea    numberbuf,a0
  1102.     bsr    num2ascii
  1103.  
  1104.     move.l    a0,d2
  1105.     move.l    d0,d3
  1106.     bsr    printtext
  1107.  
  1108.     move.l    #text_doublespace,d2
  1109.     moveq    #2,d3
  1110.     bsr    printtext
  1111.  
  1112.     move.l    writtenbytes,d0
  1113.     move.l    readbytes,d1
  1114.     bsr    percentage
  1115.  
  1116.     lea    numberbuf,a0
  1117.     bsr    num2ascii
  1118.  
  1119.     move.l    a0,d2
  1120.     move.l    d0,d3
  1121.     bsr    printtext
  1122.  
  1123.     move.l    #text_percentsign,d2
  1124.     move.l    #5,d3
  1125.     bsr    printtext
  1126.  
  1127.     move.l    #text_lf,d2
  1128.     move.l    #1,d3
  1129.     bsr    printtext
  1130.     bra    endprogram1
  1131.  
  1132. helptext:
  1133.     move.l    #text_helptext,d2
  1134.     move.l    #len_helptext,d3
  1135.     bsr    printtext
  1136.     bra    endprogram1
  1137.  
  1138. credits:
  1139.     move.l    #text_credits,d2
  1140.     move.l    #len_credits,d3
  1141.     bsr    printtext
  1142.     bra    endprogram1
  1143.  
  1144.     if    testmode=1
  1145. err_testmode:
  1146.     move.l    #$ffff,d0
  1147.  
  1148. err_testmode1:
  1149.     move.w    #$f00,$dff180
  1150.     dbf    d0,err_testmode1
  1151.     bra    endprogram1
  1152.     endc
  1153.  
  1154. err_nosource:
  1155.     move.l    #text_nosource,d2
  1156.     moveq    #28,d3
  1157.     bsr    printerror
  1158.     bra    endprogram1
  1159.  
  1160. err_badcomline:
  1161.     move.l    #text_badcomline,d2
  1162.     moveq    #17,d3
  1163.     bsr    printerror
  1164.     bra    endprogram1
  1165.  
  1166. err_nodest:
  1167.     move.l    #text_nodest,d2
  1168.     moveq    #33,d3
  1169.     bsr    printerror
  1170.     bra    endprogram2
  1171.  
  1172. err_badmode:
  1173.     move.l    #text_badmode,d2
  1174.     moveq    #24,d3
  1175.     bsr    printerror
  1176.     bra    endprogram1
  1177.  
  1178. err_nocomlinespace:
  1179.     move.l    #text_nocomlinespace,d2
  1180.     moveq    #52,d3
  1181.     bsr    printerror
  1182.     bra    endprogram1
  1183.  
  1184. err_badlogic:
  1185.     move.l    #text_badlogic,d2
  1186.     moveq    #25,d3
  1187.     bsr    printerror
  1188.     bra    endprogram1
  1189.  
  1190. err_nomem:
  1191.     move.l    #text_nomemory,d2
  1192.     moveq    #36,d3
  1193.     bsr    printerror
  1194.     bsr    closesource
  1195.     bra    endprogram1
  1196.  
  1197. err_powerpacked:
  1198.     move.l    #text_powerpacked,d2
  1199.     moveq    #48,d3
  1200.     bsr    printerror
  1201.     bsr    closesource
  1202.     bra    endprogram1
  1203.  
  1204. err_seekfail:
  1205.     move.l    #text_badsource,d2
  1206.     moveq    #23,d3
  1207.     bsr    printerror
  1208.     bsr    closesource
  1209.     bra    endprogram1
  1210.  
  1211. err_readfail:
  1212.     move.l    #text_badsource,d2
  1213.     moveq    #23,d3
  1214.     bsr    printerror
  1215.     bsr    closesource
  1216.     tst.b    mode_nobuffer
  1217.     beq    err_readfail1
  1218.     bsr    closedest
  1219.     bra    endprogram1
  1220.  
  1221. err_readfail1:
  1222.     bsr    freememory
  1223.     bra    endprogram1
  1224.  
  1225. err_writefail:
  1226.     move.l    #text_baddest,d2
  1227.     moveq    #18,d3
  1228.     bsr    printerror
  1229.     bsr    closesource
  1230.     tst.b    mode_nobuffer
  1231.     beq    err_writefail1
  1232.     bsr    closedest
  1233.     bra    endprogram1
  1234.  
  1235. err_writefail1:
  1236.     bsr    freememory
  1237.     bra    endprogram1
  1238.  
  1239. endprogram5:
  1240.     tst.b    mode_nobuffer
  1241.     beq    endprogram6
  1242.  
  1243.     bsr    closesource
  1244.     bsr    closedest
  1245.  
  1246.     move.l    #destname,d1
  1247.     move.l    dosbase,a6
  1248.     jsr    deletefile(a6)        ; error detection here
  1249.  
  1250.     move.l    #text_break,d2
  1251.     moveq    #20,d3
  1252.     bsr    printtext
  1253.     bra    endprogram1
  1254.  
  1255. endprogram6:
  1256.     bsr    closedest
  1257.     bsr    freememory
  1258.  
  1259.     move.l    #destname,d1
  1260.     move.l    dosbase,a6
  1261.     jsr    deletefile(a6)        ; error detection here
  1262.  
  1263.     move.l    #text_break,d2
  1264.     moveq    #20,d3
  1265.     bsr    printtext
  1266.     bra    endprogram1
  1267.  
  1268. breakpressed:                ; source and mem open, dest not
  1269.     bsr    freememory
  1270.     bsr    closesource
  1271.     move.l    #text_break,d2
  1272.     moveq    #20,d3
  1273.     bsr    printtext
  1274.     bra    endprogram1
  1275.  
  1276. endprogram3:
  1277.     bsr    closedest
  1278.  
  1279. endprogram2:
  1280.     tst.b    mode_nobuffer        ; closes source if nobuffer
  1281.     beq    endprogram1
  1282.     bsr    closesource
  1283.  
  1284. endprogram1:
  1285.     move.l    #text_cursoron,d2
  1286.     moveq    #5,d3
  1287.     bsr    printtext
  1288.  
  1289.     move.l    execbase,a6
  1290.     move.l    dosbase,a1
  1291.     jsr    closelibrary(a6)
  1292.     moveq    #0,d0
  1293.     rts
  1294.  
  1295.  
  1296. **********
  1297. ** SUBS **
  1298. **********
  1299.  
  1300. freememory:
  1301.     move.l    sourcepointer,a1
  1302.     move.l    sourcelen,d0
  1303.     move.l    execbase,a6
  1304.     jsr    freemem(a6)
  1305.     rts
  1306.  
  1307. closedest:
  1308.     move.l    desthandle,d1
  1309.     move.l    dosbase,a6
  1310.     jsr    close(a6)
  1311.     rts
  1312.  
  1313. closesource:
  1314.     move.l    sourcehandle,d1
  1315.     move.l    dosbase,a6
  1316.     jsr    close(a6)
  1317.     rts
  1318.  
  1319. printerror:
  1320.     movem.l    d2/d3,-(a7)
  1321.     move.l    #text_error,d2
  1322.     move.l    #8,d3
  1323.     bsr    printtext
  1324.     movem.l    (a7)+,d2/d3
  1325.     bsr    printtext
  1326.     rts
  1327.  
  1328. printtext:
  1329.     if    testmode=1
  1330.     rts
  1331.     endc
  1332.  
  1333.     move.l    outstruct,d1
  1334.     move.l    dosbase,a6
  1335.     jsr    write(a6)
  1336.     rts
  1337.  
  1338. skipspace:
  1339.     cmp.b    #" ",(a0)
  1340.     beq    skipspace1
  1341.     rts
  1342.  
  1343. skipspace1:
  1344.     addq.l    #1,a0
  1345.     cmp.l    commandend,a0
  1346.     bcs    skipspace
  1347.     move.l    #0,a0
  1348.     rts
  1349.  
  1350. findend:
  1351.     cmp.b    #'"',(a0)
  1352.     beq    findend_quote
  1353.  
  1354. findend_space:
  1355.     addq.l    #1,a0
  1356.     cmp.b    #" ",(a0)
  1357.     beq    findend_space1
  1358.     cmp.b    #0,(a0)
  1359.     beq    findend_space1
  1360.     cmp.l    commandend,a0
  1361.     bls    findend_space
  1362.     move.l    #0,a0
  1363.     rts
  1364.  
  1365. findend_space1:
  1366.     subq.l    #1,a0
  1367.     rts
  1368.  
  1369. findend_quote:
  1370.     addq.l    #1,a0
  1371.     cmp.b    #'"',(a0)
  1372.     bne    findend_quote1
  1373.     rts
  1374.  
  1375. findend_quote1:
  1376.     cmp.l    commandend,a0
  1377.     bls    findend_quote
  1378.     move.l    #0,a0
  1379.     rts
  1380.  
  1381. removequotes:
  1382.     cmp.b    #'"',(a0)
  1383.     beq    removequotes1
  1384.     rts
  1385.  
  1386. removequotes1:
  1387.     addq.l    #1,a0
  1388.     subq.l    #2,d0
  1389.     rts
  1390.  
  1391.     include    "src:Num2ASCII-2.S"
  1392.     include    "src:Percentage.S"
  1393.  
  1394. **********
  1395. ** DATA **
  1396. **********
  1397.  
  1398.     section    fastdata,data
  1399.  
  1400. spacepointer:
  1401.     dc.l    spacebuf
  1402.  
  1403. table_frompc:
  1404.     dc.b    $00,$0d
  1405.     dc.b    $00,$1a
  1406.     dc.b    $b6,$14
  1407.     dc.b    $e7,$80
  1408.     dc.b    $dc,$81
  1409.     dc.b    "å",$83
  1410.     dc.b    "ä",$84
  1411.     dc.b    "Ä",$8e
  1412.     dc.b    $e6,$91
  1413.     dc.b    $c6,$92
  1414.     dc.b    "ö",$94
  1415.     dc.b    "Ö",$99
  1416.     dc.b    $7f,$b0
  1417.     dc.b    $7f,$b1
  1418.     dc.b    $7f,$b2
  1419.     dc.b    "|",$b3
  1420.     dc.b    "#",$b6
  1421.     dc.b    "+",$b7
  1422.     dc.b    "|",$ba
  1423.     dc.b    "#",$bb
  1424.     dc.b    "#",$bc
  1425.     dc.b    "+",$bd
  1426.     dc.b    "+",$bf
  1427.     dc.b    "+",$c0
  1428.     dc.b    "+",$c3
  1429.     dc.b    "-",$c4
  1430.     dc.b    "#",$c8
  1431.     dc.b    "#",$c9
  1432.     dc.b    "=",$cd
  1433.     dc.b    "+",$d3
  1434.     dc.b    "#",$d4
  1435.     dc.b    "+",$d9
  1436.     dc.b    "+",$d6
  1437.     dc.b    "+",$da
  1438.     dc.b    "|",$dd
  1439.     dc.b    "|",$de
  1440.     dc.b    $b7,$f9
  1441.     dc.b    $b7,$fa
  1442.     dc.b    $b7,$fe
  1443.  
  1444.     dc.w    0
  1445.  
  1446. text_helptext:
  1447.     incbin    "src:Port/PortOpts1"
  1448.  
  1449. text_credits:
  1450.     incbin    "src:Port/PortOpts2"
  1451.  
  1452. text_cursoroff:
  1453.     dc.b    27,"[0 p"
  1454.  
  1455. text_cursoron:
  1456.     dc.b    27,"[1 p"
  1457.  
  1458. text_error:
  1459.     dc.b    "ERROR!  "
  1460.  
  1461. text_badcomline:
  1462.     dc.b    "Bad commandline.",10
  1463.  
  1464. text_nosource:
  1465.     dc.b    "Could not open source file.",10
  1466.  
  1467. text_nodest:
  1468.     dc.b    "Could not open destination file.",10
  1469.  
  1470. text_badmode:
  1471.     dc.b    "Bad mode specification.",10
  1472.  
  1473. text_nocomlinespace:
  1474.     dc.b    "The mode must be separated with at least one space.",10
  1475.  
  1476. text_badlogic:
  1477.     dc.b    "Conflict in commandline.",10
  1478.  
  1479. text_nomemory:
  1480.     dc.b    "Not enough memory to load the file.",10
  1481.  
  1482. text_powerpacked:
  1483.     dc.b    "File is a PowerPacker data file, can't process.",10
  1484.  
  1485. text_badsource:
  1486.     dc.b    "Source file corrupted.",10
  1487.  
  1488. text_baddest:
  1489.     dc.b    "Can't write data.",10
  1490.  
  1491. text_input:
  1492.     dc.b    27,"[1mInput: ",27,"[0m"
  1493.  
  1494. text_output:
  1495.     dc.b    "  ",27,"[1mOutput: ",27,"[0m"
  1496.  
  1497. text_read:
  1498.     dc.b    27,"[1mRead: ",27,"[0m"
  1499.  
  1500. text_converted:
  1501.     dc.b    27,"[1mConverted: ",27,"[0m"
  1502.  
  1503. text_break:
  1504.     dc.b    27,"[1m-BREAK-",27,"[0m",27,"[0K",10
  1505.  
  1506. dosname:
  1507.     dc.b    "dos.library",0
  1508.  
  1509. text_amigasuf:
  1510.     dc.b    ".AMI"
  1511.  
  1512. text_pcsuf:
  1513.     dc.b    ".PC"
  1514.  
  1515. text_sf7suf:
  1516.     dc.b    ".SF7"
  1517.  
  1518. text_cr:
  1519.     dc.b    13
  1520.  
  1521. text_lf:
  1522.     dc.b    10
  1523.  
  1524. text_final:
  1525.     dc.b    27,"[1mFile size change:",27,"[0m "
  1526.  
  1527. text_negsign:
  1528.     dc.b    "-"
  1529.  
  1530. text_possign:
  1531.     dc.b    "+"
  1532.  
  1533. text_percentsign:
  1534.     dc.b    "%",27,"[0K"
  1535.  
  1536. text_doublespace:
  1537.     dc.b    "  "
  1538.  
  1539. text_slash:
  1540.     dc.b    "/"
  1541.  
  1542.     if    testmode=1
  1543.  
  1544. test_comline:
  1545.     dc.b    "n ram:test ram:shit3",10
  1546.  
  1547. test_comlineend:
  1548.  
  1549. test_len    =    test_comlineend-test_comline
  1550.  
  1551.     endc
  1552.  
  1553.     section    fastblank,bss
  1554.  
  1555. eols:
  1556.     ds.l    1
  1557.  
  1558. sourcelock:
  1559.     ds.l    1
  1560.  
  1561. readasciiaddr:
  1562.     ds.l    1
  1563.  
  1564. sourcepointer:
  1565.     ds.l    1
  1566.  
  1567. table:
  1568.     ds.l    1
  1569.  
  1570. sourcelen:
  1571.     ds.l    1
  1572.  
  1573. tabs:
  1574.     ds.l    1
  1575.  
  1576. writtenbytes:
  1577.     ds.l    1
  1578.  
  1579. readbytes:
  1580.     ds.l    1
  1581.  
  1582. leftbytes:
  1583.     ds.l    1
  1584.  
  1585. inputbytes:
  1586.     ds.l    1
  1587.  
  1588. sourcehandle:
  1589.     ds.l    1
  1590.  
  1591. desthandle:
  1592.     ds.l    1
  1593.  
  1594. outstruct:
  1595.     ds.l    1
  1596.  
  1597. destnamestart:
  1598.     ds.l    1
  1599.  
  1600. destnameend:
  1601.     ds.l    1
  1602.  
  1603. destnamelen:
  1604.     ds.l    1
  1605.  
  1606. sourcenamestart:
  1607.     ds.l    1
  1608.  
  1609. sourcenameend:
  1610.     ds.l    1
  1611.  
  1612. sourcenamelen:
  1613.     ds.l    1
  1614.  
  1615. commandstart:
  1616.     ds.l    1
  1617.  
  1618. commandend:
  1619.     ds.l    1
  1620.  
  1621. commandlen:
  1622.     ds.l    1
  1623.  
  1624. dosbase:
  1625.     ds.l    1
  1626.  
  1627. spacenumber:
  1628.     ds.l    1
  1629.  
  1630. readasciilen:
  1631.     ds.l    1
  1632.  
  1633. sourcelenasciilen:
  1634.     ds.l    1
  1635.  
  1636. sourcelenasciiaddr:
  1637.     ds.l    1
  1638.  
  1639. col:
  1640.     ds.w    1
  1641.  
  1642. ; all bytedata that needs to be word-aligned here
  1643.  
  1644. fib:
  1645.     ds.b    260
  1646.  
  1647. mode:
  1648.     ds.b    1
  1649.  
  1650. sourcename:
  1651.     ds.b    256
  1652.  
  1653. destname:
  1654.     ds.b    256
  1655.  
  1656.     even
  1657.  
  1658. sourcebuf:
  1659.     ds.b    1024
  1660.  
  1661. destbuf:
  1662.     ds.b    9216
  1663.  
  1664. spacebuf:
  1665.     ds.b    1024
  1666.  
  1667. numberbuf:
  1668.     ds.b    10
  1669.  
  1670. readascii:
  1671.     ds.b    10
  1672.  
  1673. sourcelenascii:
  1674.     ds.b    10
  1675.  
  1676. tabsize:
  1677.     ds.b    1
  1678.  
  1679. spacesize:
  1680.     ds.b    1
  1681.  
  1682. prespace:
  1683.     ds.b    1
  1684.  
  1685. mode_case:
  1686.     ds.b    1
  1687.  
  1688. mode_nocutspace:
  1689.     ds.b    1
  1690.  
  1691. mode_quiet:
  1692.     ds.b    1
  1693.  
  1694. mode_nobuffer:
  1695.     ds.b    1
  1696.  
  1697. len_helptext    =    text_credits-text_helptext
  1698. len_credits    =    text_cursoroff-text_credits
  1699.